#include "cc_log.h"
#include "cc_core.h"
#include "cc_mempool.h"

#if (CC_CONFIG_TEST_COND == 1)
cc_cond_t cond;
int test_cond_create()
{
  cond = cc_cond_create();
  return 1;
}
CC_INIT_BOARD_REGISTER(test_cond_create);

void t1_cond(void* data)
{
  while (1)
  {
    cc_log("t1 wait\r\n");
    cc_cond_wait(cond);
    cc_log("t1 success\r\n");
    cc_delay(1000);
  }
}
CC_THREAD_REGISTER(t1_cond, 10, 2048);

void t2_cond(void* data)
{
  while (1)
  {
    cc_log("t2 wait\r\n");
    cc_cond_wait(cond);
    cc_log("t2 success\r\n");
    cc_delay(1000);
  }
}
CC_THREAD_REGISTER(t2_cond, 10, 2048);

void t3_cond(void* data)
{
  while (1)
  {
    cc_delay(5000);
    cc_cond_broadcast(cond);
    cc_log("t3 broad cast\r\n");
  }
}
CC_THREAD_REGISTER(t3_cond, 10, 2048);
#endif